package cn.javaee.springmvc.service;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import cn.javaee.springmvc.model.Address;
import cn.javaee.springmvc.model.Login;
import cn.javaee.springmvc.model.User;

public interface UserDao {
	@Update("insert into user(username,password,name,sex,phone) "
			+ "values(#{username},#{password},#{name},#{sex},#{phone})")
	int registerUser(User user);
	@Update("insert into address(`username`, `national`, `province`, `city`, `street`, `zipcode`) "
			+ "values(#{User.username},#{address.national},#{address.province},#{address.city},#{address.street},#{address.zipcode})")
	int registerAddress(@Param("User")User user,@Param("address1")Address address);
	@Select("select * from user where username=#{username} limit 1")
	User validateUser(Login login);
}
